<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>-.-</title>

    <link rel="stylesheet" href="{CSS}admin/reset.css">
    <link rel="stylesheet" href="{CSS}admin/bootstrap-admin.css">
    <link rel="stylesheet" href="{CSS}admin/backstage.css">
    <link rel="stylesheet" href="{CSS}public/page.css">
    <script src="{JS}public/jquery-1.8.3.min.js"></script>
    <script>pageurl="?m=admin&c=Goodsc&a=goods_list";</script>
    <script src="{JS}public/page.js"></script>
</head>

<body>

<span class="main-title">商品列表</span>
<div class="details">
    <div class="details_operation clearfix">
        <div class="bui_select">
            <input class="btn btn-primary" type="button" value="添加商品" class="add" onclick="addPro()">
        </div>
        <div class="fr">

        </div>
        <div class="details_operation clearfix">

            <div class="fl">
            </div>

            <div class="fr">
                <div class="text">

                <span>
                                <input type="text" value="" placeholder="搜索如:商品编号/店铺ID/价格" class="search form-control" name="search">
                                </span>
                    <span>
                    <input type="button" value="搜索" id="search" class="btn btn-primary">
                </span>
                </div>
            </div>
        </div>
    </div>
    <!--表格-->
    <div id="show">
    <table  class="table  table-hover">
        <thead>
        <tr>
            <th width="15%">商品编号</th>
            <th width="15%">商品名称</th>
            <th width="10%">商品分类</th>
            <th width="10%">店铺ID</th>
            <th width="10%">价格</th>
            <th width="10%">库存</th>
            <th width="15%">发布时间</th>
            <th width="15%">商品图像</th>
            <th width="10%">操作</th>
        </tr>
        </thead>
        <tbody>
        {if $data neq ""}
       {foreach $data as $key=>$val}
        <tr align="center">
            <!--这里的id和for里面的c1 需要循环出来-->
            <td>{$val.pSn}</td>
            <td>{$val.pName}</td>
            <td>{$val.cateName}</td>
            <td>{$val.shopId}</td>
            <td>{$val.priceB}（元）</td>
            {if $val.pNum eq 0}
            <td>无限制</td>
            {else}
            <td>{$val.pNum}（件）</td>
            {/if}
            <td>{$val.pubTime}</td>
            <td><img src="{APP_UPLOAD}upload/goods_image_thumb_50/{$val.icon}"/></td>
            <td>
                <a class="btn btn-link" onclick="editPro({$val.id},{$val.pSn})">修改</a><a class="btn btn-link"  onclick="delPro({$val.id})">删除</a>
            </td>
        </tr>
       {/foreach}
        </tbody>
    </table>
        {$page}
        <p align="center">共{$count}条数据</p>
        {/if}
    </div>

</div>
<script type="text/javascript">
    function showDetail(id,t){
        $("#showDetail"+id).dialog({
            height:"auto",
            width: "auto",
            position: '{literal}{my: "center", at: "center",  collision:"fit"}{/literal}',
            modal:false,//是否模式对话框
            draggable:true,//是否允许拖拽
            resizable:true,//是否允许拖动
            title:"商品名称："+t,//对话框标题
            show:"slide",
            hide:"explode"
        });
    }
    function addPro(){
        window.location='?m=admin&c=Goodsc&a=index';
    }
    function editPro(id,pSn){
        window.location='?m=admin&c=Goodsc&a=goods_edit&id='+id+'&pSn='+pSn;
    }
    function delPro(id){
        if(window.confirm("您确认要删除嘛？添加一次不易，且删且珍惜!")){
            window.location="?m=admin&c=Goodsc&a=goods_delete&id="+id;
        }
    }
    function search(){
        if(event.keyCode==13){
            var val=document.getElementById("search").value;
            window.location="listPro.php?keywords="+val;
        }
    }
    function change(val){
        window.location="listPro.php?shopId="+val;
    }
</script>
</body>
</html>